#include "ConditionImpl.h"

OneOfAttributeConditionImpl::OneOfAttributeConditionImpl()
{

}

OneOfAttributeConditionImpl::OneOfAttributeConditionImpl(
								const string& _localName,
								const string& _value)
	:localName(_localName), value(_value)
{

}

OneOfAttributeConditionImpl::~OneOfAttributeConditionImpl()
{

}

Condition* OneOfAttributeConditionImpl::Copy()const
{
	return new OneOfAttributeConditionImpl(localName, value);
}

Condition::ConditionType OneOfAttributeConditionImpl::getConditionType()const
{
	return Condition::SAC_ONE_OF_ATTRIBUTE_CONDITION;
}

const string* OneOfAttributeConditionImpl::toString()const
{
	string* result = NULL;
	try
	{
		result = new string;
		result->append("[");
		result->append(localName);
		result->append("~=\"");
		result->append(value);
		result->append("\"]");
	}catch(std::exception& e)
	{
		if(result)
			delete result;
		return NULL;
	}
	return result;
}

const string* OneOfAttributeConditionImpl::getNameSpaceURI()const
{
	return NULL;
}

const string* OneOfAttributeConditionImpl::getLocalName()const
{
	return &localName;
}

bool OneOfAttributeConditionImpl::getSpecified()const
{
	return true;
}

const string* OneOfAttributeConditionImpl::getValue()const
{
	return &value;
}
